package com.qfedu.dao.impl;

import com.qfedu.dao.ITypeDao;
import com.qfedu.entity.Type;
import com.qfedu.utils.JDBCUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class TypeDaoImpl implements ITypeDao {
    @Override
    public List<Type> listType() {
        try {
            return new QueryRunner(JDBCUtil.getDataSource()).query("select id,name,info from type",new BeanListHandler<Type>(Type.class));
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }
}
